CDWriterXP ActiveX Control

 
 

Overview

 
 

Basic Operation -  

The control is capable of several tasks related to writing audio and data discs. It is important to understand the recording process before attempting to use the control in an application. The CDWriterXP has two basic functions - recording Data and Audio CDs. All other functionality is used to support these operations. 

 

Data Tracks (ISO9660/Joliet)- 

By far, the most useful feature of CDWriterXP, is the ability to record data CDs. The uses for this feature include data archiving, creating kiosks, and a multitude of other applications. The CDWriterXP supports writing ISO9660 or Joliet data discs. 

ISO9660 - (Level 1/Level 2)

Two forms of ISO9660 exist, Level 1 and Level 2. The ISO9660 Level 1 standard allows an 8 character filename + 3 character extension. This is often referred to as 8.3 format. Most off-the-shelf software on CD-Rom comes in this format. Level 2 offers more relaxed restrictions (31 characters maximum). ISO9660 also limits any given fully qualified path to 255 characters and does not allow a directory depth of more than 8 directories deep.  

Joliet - 

Joliet is a more common format among Windows users because it supports file and directory names of up to 64 characters. It also allows characters which are more favorable to the long filename conventions of Windows. Joliet also has no restrictions on directory tree depth or path size.

Data Disc Basics -

A data track is written to the CD just like an audio track except a directory structure is written along with file data as one contiguous track. Only one data track can be read by the OS at one time. Unlike audio, the last data track on the CD is the one which the OS will use to determine which files are on the disc. All previous data tracks are disregarded unless they were linked into the image of last track written. In other words, on a disc with multiple data tracks, the OS will only see the last recorded data track. Linking (importing a previous session/track) allows files from previous data tracks to be visible from the last session recorded. This is done by including the address of previously written files (of the previous data track) in the directory structure of the new data track's image. This is commonly called 'continuing a multi-session disc'. This functionality allows an update/addition of files (written previously) without the need to write all of the file data again - except the updated files. After a data track has been written, either the session or the disc should be closed. The disc should be closed if no further data needs to be written to the disc - ever. At the very least, the session should be closed so that the disc is useable. Some operating systems do not recognize unclosed data tracks. The OS may also need the disc ejected and reloaded before recognizing a newly recorded data track.

Using CDWriterXP to Write a Data Track -

To create a data image for a track, files and/or directories can be added either one at a time (InsertISOItem) , or an entire directory can be cloned (CloneDirectoryToISO) to an destination image path. The control will not validate filename lengths, but it will alter names as needed to conform the current image specifications (ISO or Joliet). As each item is added to the image, a ISOItemAdded event will indicate a successful addition. When the appropriate files have been added to the image, set various properties as required (e.g. CloseSession, CloseDisc,  CacheDataTrack), and call WriteDisc to begin the recording operation. See the sample code. Use the caching option if recording from a network source, or on a slow system.

Using CDWriterXP to Write an Imported Multi-Session Data Track

If the last session needs to be imported, it must be done prior to adding any other items to the image. If you record a session/track with 'FileA.txt', and then record another session/track with 'FileB.txt'; only 'FileB.txt' will appear in the OS's file system. The first session is superseded by the last session. The only way around this problem, is by importing the previous session into the new data image. Importing a data track links a previous session's file information with the new session. CDWriterXP supports this technology by using the ImportISOTrack method. If importing is not used, a new session will overwrite the previous session and all of the files must be written again (taking up unnecessary space). After importing the last session, follow the Using CDWriterXP to Write a Data Track section (above) to write the disc. Important: Only the last session/track is imported by the control to prevent confusion. The disc must remain present in the drive after the import, or the recording will not work properly. CDWriterXP relies on the presence of the imported disc for a successful write operation. Only Mode 1 CD-Rom discs can be imported (XA or any other modes are not supported, but may work). 

 

Audio Discs - 

Audio discs can be created from the control consisting of tracks from either .mp3 or .wav source files. Audio discs are recorded in TAO (Track-at-Once) recording mode. TAO is supported by almost every CDR on the market. Tracks can be added to an audio image by using the InsertAudioTrack method of the control. Tracks can be inserted, removed, and enumerated using various audio track specific methods of the control. The .wav files must be 16 bit, stereo, and 44.1khz format in order to be used with the control. MP3 files must be high-quality stereo format with a decent bit rate to get good results. After adding the tracks to the audio image, set the CloseDisc and CloseSession properties to a value of True. The disc and session must be closed to allow playback on 'normal' CD players. The WriteType  property must also be set for audio recording. Use the WriteDisc method to initiate recording to the CDR drive. Mp3 tracks will be decompressed on-the-fly during recording unless the CacheAudioTracks property is set to a value of True. Some systems are too slow for on-the-fly decoding, or the files may be from a network location (slowing performance). In these cases, use the caching ability for error free recording. 

 

Other Operations -  

A number of utility features exist to manage the writing process. 

Track Item Enumerations -

To solve speed issues associated with collections, extensive use was made of enumeration events. Instead of needing to manage large collections of data (e.g. ISO items), methods may be called which will fire an event for each item in the control's collection. For example, to get a list of ISO files added to an image directory, one would make a call to EnumerateISOItems. This method would cause the control to fire the EnumISOItems event for each item in the associated image path. This type of architecture makes it easy to manage tree views and lists of image items. This same approach is also used for audio data through the EnumerateAudioTracks method and the EnumAudioTrack event.

Writing/Saving ISO Files -

The ISO image may be saved as a generic ISO file for use by other applications using the CreateISOImageFile method. Generic ISO files can also be written by the control using the WriteISOImage method. The only constraint using this method is that the disc must be blank.

ISO/Joliet File and Directory Manipulation -

Many methods exist for removing, renaming, and adding directory/file items. Most of these methods have corresponding events to confirm the operation, and to modify the GUI to reflect the changes. For example, when a directory is renamed using RenameISODirectory, all of the image destination paths for the child items change. To reflect this modification, the ISODestPathChanged event will fire for each child item so modifications can be made to the item's GUI components if necessary. The samples contain working examples if this functionality.

 

Errors -  

CDWriterXP takes great care in reporting very detailed errors when required. A number of enumerations/constants exist for explaining error conditions. We have attempted to accommodate most drives on the market, but due to the changing nature of this technology, we do not guarantee universal functionality with every drive. 

 

Licensing -  

After purchasing a CDWriterXP license, the control needs to be registered by setting the LicenseCode property with the code sent with the receipt of purchase (usually an email). This property may be set at runtime, or at design time. A runtime license allows runtime distribution of the control for commercial applications without any further fees or royalty payments.